package cn.yunbamboos.rest.service.apidoc.meta;

import cn.yunbamboos.rest.service.apidoc.IMeta;
import com.alibaba.fastjson2.JSONObject;

public class Parameter implements IMeta {

    private String name;
    /**
     * 必选. 参数的位置，可能的值有 "query", "header", "path" 或 "cookie"
     * */
    private String in;
    private String description;
    private boolean required;
    private String example;
    private Schema schema;

    @Override
    public JSONObject toJSON() {
        JSONObject json = new JSONObject();
        json.put("name", name);
        json.put("in", in);
        json.put("description", description);
        json.put("required", required);
        json.put("example", example);
        json.put("schema", schema.toJSON());
        return json;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setIn(String in) {
        this.in = in;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setRequired(boolean required) {
        this.required = required;
    }

    public void setExample(String example) {
        this.example = example;
    }

    public void setSchema(Schema schema) {
        this.schema = schema;
    }
}
